<<<<<<< HEAD
$('.index_main_l>ul>li').hover(function() {
=======

if(location.search){
    var loginTemp = `
    <img src="https://x.dscmall.cn/storage/images/1%20-%20%E5%89%AF%E6%9C%AC.jpg" alt="">
                    <div class="login_info">
                        <span>Hi， efUdrx-542733</span>
                        <a href="" class="login_cccc">进入会员中心</a>
                    </div>
    `
    $('.user_info').html(loginTemp);
}else{
    var loginTemp = `
    <img src="https://x.dscmall.cn/themes/ecmoban_dsc2017/images/avatar.png" alt="">
                    <div class="login_info">
                        <span>Hi，欢迎来到大商创!</span>
                        <a href="" class="login_button">请登录</a>
                        <a href="" class="register_button">我要开店</a>
                    </div>
    `
    $('.user_info').html(loginTemp);
}
$('.index_main_l>ul>li').hover(function () {
>>>>>>> 086ef85d6255716b9a53ad2adcfaa9c1a741d2ee
    $(this).addClass('active').siblings().removeClass('active');
    $('.main_tab_cont').removeClass('no');
    $(this).find('.main_tab_cont').addClass('no');

}, function() {
    $('.index_main_l>ul>li').removeClass('active')
    $('.main_tab_cont').removeClass('no');
})

// 公告 | 促销
$('.new_itme a').mouseenter(function() {
        var temp = $(this).index('.new_itme a');
        $(this).addClass('active').siblings().removeClass('active');
        $(this).parents('.new_itme').find('.con ul').eq(temp).addClass('active').siblings().removeClass('active');

    })
    // 主题轮播图淡入淡出,焦点轮播

var lb = $('.carousel')[0];
var con = 1;

function lbTime() {
    clearInterval(lb.time);
    lb.time = setInterval(function() {
        if (con == 5) {
            con = 0;
        }
        $('.carousel li').eq(con).fadeIn(200).siblings().fadeOut(200);
        $('.focus i').eq(con).addClass('active').siblings().removeClass('active');
        con++;
    }, 3000)
}
lbTime();
$('.conter').hover(function() {
    clearInterval(lb.time);
}, function() {
    lbTime();
})
$('.focus i').click(function() {
        var index = $(this).index();
        $('.carousel li').eq(index).fadeIn(200).siblings().fadeOut(200);
        $(this).addClass('active').siblings().removeClass('active');
    })
    // 周年庆轮播
$('.seckill_cont').hover(function() {
    clearInterval(self.time)
    $('.boult').css('display', 'block');
}, function() {
    $('.boult').css('display', 'none');
    miaoTime();
})

var home = HomePage.carousel;
var tempHome = '';
for (var i = 7; i < home.length; i++) {
    tempHome += `
    <li>
                <a href="../page/product.html?${home[i].goodid}" data-id="${home[i].goodid}" class = "skip">
                    <img src="${home[i].pictureURL}" alt="">
                    <div class="p_1" title="${home[i].Hometitle}">${home[i].Hometitle}</div>
                    <div class="p_2">
                        <span>${'¥' + home[i].Homeprice}</span>
                        <del>${'¥' + home[i].HomeZKprice}</del>
                    </div>
                </a>
            </li>
    `
}
$('.extra_oul').html(tempHome);
var tempHuod = '';
for (var i = 0; i < 6; i++) {
    tempHuod += `
    <li>
                <a href="../page/productDetailsPage.html?${'HomePage.carousel'+'&'+home[i].goodid}" data-id="${home[i].goodid}" class = "skip">
                    <img src="${home[i].pictureURL}" alt="">
                    <div class="p_1" title="${home[i].Hometitle}">${home[i].Hometitle}</div>
                    <div class="p_2">
                        <span>${'¥' + home[i].Homeprice}</span>
                        <del>${'¥' + home[i].HomeZKprice}</del>
                    </div>
                </a>
            </li>
    `
}
tempHuod += tempHuod
$('.seck_sel').html(tempHuod);

var bl = $('.b_l')[0];
var br = $('.b_r')[0];
var sec = $('.seckill_cont')[0];
var seck_oul = $('.seck_sel')[0];
var secIndex = 0;

function huan(ele, max, shi) {
    clearInterval(ele.time);
    ele.time = setInterval(function() {
        var temp = ele.offsetLeft;
        if (temp == max) {
            clearInterval(ele.time);
        } else {
            var tage = (max - temp) / 10;
            if (tage > 0) {
                tage = Math.ceil(tage);
            } else if (tage < 0) {
                tage = Math.floor(tage);
            }
            ele.style.left = temp + tage + "px";
        }
    }, shi)
}
br.onclick = function() {
    secIndex++;
    if (secIndex == 8) {
        seck_oul.style.left = "0px";
        secIndex = 1;
    }
    var t = secIndex * -238;
    huan(seck_oul, t, 20);
}

function miaoTime() {

    self.time = setInterval(function() {
        br.onclick();
    }, 2000)
}
miaoTime();
bl.onclick = function() {
    secIndex--;
    if (secIndex < 0) {
        seck_oul.style.left = "0";
        secIndex = 0;
    }
    var t = secIndex * -240;
    huan(seck_oul, t, 20);
}
var main1OffsetTop = $('.visual_item').offset().top;
$(window).scroll(function() {
        // 侧边栏显示
        if ($(window).scrollTop() >= main1OffsetTop) {
            $('.jump').stop().fadeIn(600);
        } else {
            $('.jump').stop().fadeOut(600);
        };
        // 使侧边栏变色
        $('.drop').each(function(index, value) {
            if ($(window).scrollTop() >= value.offsetTop) {
                $('.jump li').eq(index).addClass('active').siblings().removeClass('active');
                $('.jump i').removeClass('on');
                $('.jump i').eq(index).addClass('on');
            }
        })
    })
    // 头部导航显示
$(window).scroll(function() {
        if ($(window).scrollTop() >= 115) {
            $('.hiedNav').stop().animate({
                top: 0
            });
        } else {
            $('.hiedNav').stop().animate({
                top: -60
            });
        }
    })
    // 跳到指定楼层
$('.jump li').not('.j_top').click(function() {
        var topIndex = $(this).index();
        var offsetTemp = $('.drop').eq(topIndex).offset().top;
        $('html').animate({
            scrollTop: offsetTemp
        }, 600)
    })
    //回到顶部
$('.jump .jum_top').click(function() {
    $('html').animate({
        scrollTop: 0
    }, 1000);
});
// 跳转详情页
$('.extra_oul').on('click', '.skip', function() {
    // 点击a,获取对应的商品信息并存放到浏览记录
    var temp = $(this).data().id;
    var tempData = JSON.stringify([HomePage.carousel[temp]]);
    if (localStorage.getItem('cookies')) {
        var tempSet = JSON.parse(localStorage.getItem('cookies'))
        tempSet.push(HomePage.carousel[temp]);
        localStorage.setItem('cookies', JSON.stringify(tempSet));
    } else {
        localStorage.setItem('cookies', tempData);
    }

})
<<<<<<< HEAD
$('.seck_sel').on('click', '.skip', function() {
    var temp = $(this).data().id;
    var tempData = JSON.stringify([HomePage.carousel[temp]]);
    if (localStorage.getItem('cookies')) {
        var tempSet = JSON.parse(localStorage.getItem('cookies'))
        tempSet.push(HomePage.carousel[temp]);
        localStorage.setItem('cookies', JSON.stringify(tempSet));
    } else {
        localStorage.setItem('cookies', tempData);
    }
})
=======
// $('.seck_sel').on('click','.skip',function(){
//     var temp = $(this).data().id;
//     var tempData = JSON.stringify([HomePage.carousel[temp]]);
//     if(localStorage.getItem('cookies')){
//         var tempSet = JSON.parse(localStorage.getItem('cookies'))
//         tempSet.push(HomePage.carousel[temp]);
//         localStorage.setItem ('cookies',JSON.stringify(tempSet));
//     }else{
//         localStorage.setItem('cookies',tempData);
//     }
// })

>>>>>>> 086ef85d6255716b9a53ad2adcfaa9c1a741d2ee
